package com.rgs.ssm.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @create 2021-02-18 22:27
 **/
public class BCryptPasswordEncoderUtils {

    private static BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    /**
     * 对密码进行加密
     * @param password
     * @return
     */
    public static String encodePassword(String password){
        return  bCryptPasswordEncoder.encode(password);
    }

    /**
     * 验证密码
     * @param password
     * @return
     */
    public static boolean matchesPassword(String password,String hashPass){
        return  bCryptPasswordEncoder.matches(password,hashPass);
    }
}
